#region Copyright information
/* Copyright information
 * 
 * FileName:   	FormBase.cs
 * DateCreated: 03-31-2007
 * Author:     	Rader
 * Email:      	mailto:rader.net@gmail.com
 * Website:		http://raderdotnet.spaces.live.com
 
 * Copyright:	This file and the codes included are owned by Rader.
				You can use or distribute this file without removing the copyright information or modifying the cotent.
				The codes included can't be used with commecial purposes,unless you have got the perssion.
*/
#endregion

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using RaderDotNet.ValidationAttributes;
using System.Reflection;
namespace RaderDotNet.ValidationAttributes.Testing
{
    public partial class FormMain : Form
    {
        public FormMain()
        {
            InitializeComponent();
        }

        private void FormMain_Load(object sender, EventArgs e)
        {
            button1.Select();
            engine = new ValidatorEngine();
            BindingFlags flags=BindingFlags.DeclaredOnly|BindingFlags.Instance|BindingFlags.NonPublic|BindingFlags.Public;
            

            ////execute directly without filter
            ////engine.Register(this, flags);
            ////engine.Register(this.userControl2_ValidatorTest1, flags);

            Type baseAttributeType = typeof(BaseCustomValidatorAttribute);
            //filt at first
            engine.Register(this, flags, baseAttributeType);
            engine.Register(this.userControl2_ValidatorTest1, flags, baseAttributeType);

        }


        ValidatorEngine engine;

        private void FormMain_Validating(object sender, CancelEventArgs e)
        {
            

        }

        private void button1_Click(object sender, EventArgs e)
        {
            //bool isValid = Validate(false);
            bool isValid=ValidateChildren(ValidationConstraints.Visible);
        }

        private void button_beforeClick(object sender, EventArgs e)
        {
            MessageBox.Show("before button click");
        }
    }
}